package vn.smartoffice.promail.config;

import java.util.Properties;

import javax.mail.Session;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import vn.smartoffice.core.ConfigurationUtil;

@Configuration
public class MailSessionConfig {

	@Autowired
	private ApplicationContext applicationContext;

	@Bean
	public Session mailSession() {
		Properties props = ConfigurationUtil.load("javamail.properties");
		props.put("mail.debug", String.valueOf(ConfigurationUtil.isDev()));
		return Session.getInstance(props, null);
	}

}
